package com.cencat.user.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 角色权限关联查询DTO
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "角色权限关联查询DTO")
public class RolePermissionQueryDTO {

    /**
     * 角色ID
     */
    @Schema(description = "角色ID", example = "1")
    private Long roleId;

    /**
     * 权限ID
     */
    @Schema(description = "权限ID", example = "1")
    private Long permissionId;

    /**
     * 角色名称
     */
    @Schema(description = "角色名称", example = "管理员")
    private String roleName;

    /**
     * 角色编码
     */
    @Schema(description = "角色编码", example = "admin")
    private String roleCode;

    /**
     * 权限名称
     */
    @Schema(description = "权限名称", example = "用户管理")
    private String permissionName;

    /**
     * 权限编码
     */
    @Schema(description = "权限编码", example = "user:manage")
    private String permissionCode;

    /**
     * 权限类型：menu-菜单，button-按钮，api-接口
     */
    @Schema(description = "权限类型", example = "menu", allowableValues = {"menu", "button", "api"})
    private String permissionType;

    /**
     * 状态：0-禁用，1-启用
     */
    @Schema(description = "状态", example = "1", allowableValues = {"0", "1"})
    private Integer status;

    /**
     * 租户ID
     */
    @NotNull(message = "租户ID不能为空")
    @Schema(description = "租户ID", example = "1")
    private Long tenantId;

    /**
     * 创建时间开始
     */
    @Schema(description = "创建时间开始", example = "2024-01-01 00:00:00")
    private LocalDateTime createTimeStart;

    /**
     * 创建时间结束
     */
    @Schema(description = "创建时间结束", example = "2024-12-31 23:59:59")
    private LocalDateTime createTimeEnd;

    /**
     * 页码
     */
    @Min(value = 1, message = "页码必须大于0")
    @Schema(description = "页码", example = "1")
    private Integer pageNum;

    /**
     * 每页大小
     */
    @Min(value = 1, message = "每页大小必须大于0")
    @Schema(description = "每页大小", example = "10")
    private Integer pageSize;

    /**
     * 排序字段
     */
    @Schema(description = "排序字段", example = "create_time")
    private String sortField;

    /**
     * 排序方向：asc-升序，desc-降序
     */
    @Schema(description = "排序方向", example = "desc", allowableValues = {"asc", "desc"})
    private String sortDirection;
}